<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script>

function getReservationDetials(confirmationNumber){
	 window.open("customer/viewTicket.do?cnum="+confirmationNumber, "register", 'height=200,width=800');
}


</script>
</head>
<body>
<% if(request.getAttribute("error") != null) {%>
<table><tr><td>&nbsp;</td></tr><tr><td style="COLOR: #ff0000; FONT-WEIGHT: bold; FONT-FAMILY: 'Verdana'; FONT-SIZE: small;">There has been an error while processing your request. Please try again.</td></tr></table>

<% 
request.setAttribute("error", null);
} else{ %>


<table><tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr></table>
<table style="COLOR: #004040; FONT-WEIGHT: bold; FONT-SIZE: x-small; FONT-FAMILY: 'Verdana'; 
vertical-align: top; border-bottom-style:solid; ; border-bottom-color: gray; 
					border-right-style:solid; ; border-right-color: gray; 
					border-left-style:solid; ; border-left-color: gray; border-top-style:solid; ; border-top-color: gray" align="center">
<thead style="BACKGROUND-COLOR: #fbfe70; font-size: " >
<tr>
<td colspan=11> Reservation Details (Click on the confirmation number for your ticket)</td>
</tr>
			
			<tr>
				<td>Journey Date</td>
				<td>Flight Number</td>
				<td>Airline</td>
				<td >Boarding Point</td>
				<td >Source</td>
				<td >Intermediate</td>
				<td >Destination</td>
				<td >EAT</td>
				<td >Int EAT</td>
				<td >Int EDT</td>
				
				<td>Confirmation Number</td>		
				
			</tr>
		</thead>
			<c:set var="i" value="1"/>
			<c:forEach items="${reservationConfirmation}" var="item">
				<c:if test="${i % 2 == 0}">
					<c:set value="BACKGROUND-COLOR: #d6d6d6;" var="style"></c:set>
				</c:if>
				<tr style="${style}">
					<c:set value="" var="style"></c:set>
				<td>
					<c:out value="${item.dateOfJourney}" />
				</td>
				<td><c:out value="${item.flight.flightNumber}" /></td>
				<td><c:out value="${item.flight.airlineName}" /></td>
				<td><c:out value="${item.boardingPoint}"></c:out></td>
				<td><c:out value="${item.flight.source}"></c:out></td>
				<td><c:out value="${item.flight.intermediate}" /></td>
				<td><c:out value="${item.flight.destination}" /></td>
				<td><c:out value="${item.flight.timeOfFlight}" /></td>
				
				<td><c:out value="${item.flight.intermediateArrivalTime}"></c:out></td>
				<td><c:out value="${item.flight.intermediateDepartureTime}" /></td>
				
				<td><a href="javascript:getReservationDetials(<c:out value="${item.confirmationNumber}" />)"><c:out value="${item.confirmationNumber}" /></a></td>		
				<c:set var="i" value="${i+1}"/>		
			
			</tr>
			</c:forEach>
		
</table>

<% } %>
</body>
</html>